﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OracleClient;
using System.Text;
using ReflectionStudio.Core.Events;
using INTEX.DataBase.Tools;
using INTEX.DataBase;
namespace WPFExcelReport
{

    public class JLTVKWZData : BaseFunction
    {

        SETINTEXDB INTEXDB = new SETINTEXDB();
        INTEXDBC INTEXDBC;
        DataRow dwTemp;
        JLTWVKDOCData m_vkd = new JLTWVKDOCData();
        public JLTVKWZData()
            : base()
        {

        }
        public JLTVKWZData(OracleConnection _myConnection, IntexReptServBLClient _proxy, string userID = "        ")
            : base(_myConnection, _proxy, userID)
        {
            INTEXDBC = new INTEXDBC(OracleDB, proxy);
        }
        public JLTVKWZData(Dictionary<string, object> DicGlobalPara)
            : base(DicGlobalPara)
        {
        }
        public DataSet BuildData(DataRow dwInput)
        {
            DataSet SReturn = new DataSet();
            DataSet SResult = new DataSet();
            try
            {
                m_vkd.OracleDB = OracleDB;
                m_vkd.proxy = proxy;
                m_vkd.INTEXDBC = this.INTEXDBC;
                dwTemp = INTEXDB.VKKOPF.NewRow();
                dwTemp["VKKMANDANT"] = dwInput["VKPMANDANT"];
                dwTemp["VKKAUFKRS"] = dwInput["VKPAUFKRS"];
                dwTemp["VKKAUFLFD"] = dwInput["VKPAUFLFD"];
                SResult = m_vkd.GetData(dwTemp);
                SReturn.Merge(SResult);
                dwTemp = INTEXDB.WBBST.NewRow();
                dwTemp["WBBMANDANT"] = dwInput["VKPMANDANT"];
                dwTemp["WBBAUFTYP"] = "K";
                dwTemp["WBBAUFKRS"] = dwInput["VKPAUFKRS"];
                dwTemp["WBBAUFLFD"] = dwInput["VKPAUFLFD"];
                SResult = INTEXDBC.QueryWBBST(dwTemp, 3);
                SReturn.Merge(SResult);
                dwTemp = INTEXDB.VVTLIEF.NewRow();
                dwTemp["VVTMANDANT"] = dwInput["VKPMANDANT"];
                dwTemp["VVTAUFTYP"] = "K";
                dwTemp["VVTAUFKRS"] = dwInput["VKPAUFKRS"];
                dwTemp["VVTAUFLFD"] = dwInput["VKPAUFLFD"];
                SResult = INTEXDBC.QueryVVTLIEF(dwTemp, 2);
                SReturn.Merge(SResult);
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            return SReturn;
        }
    }
}